package com.bindapp.model;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.annotation.IdRes;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RadioGroup;

import com.bindapp.R;
import com.bindapp.databinding.ActivityHcBinding;

/**
 * Created by apple on 2018/7/10.
 */

public class ControllerHcModel extends BaseModel {
    private ActivityHcBinding binding;

    public ControllerHcModel(Context context){
        super(context);
        binding= DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.activity_hc,null,false);
        binding.rgBox.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, @IdRes int checkedId) {
                switch (checkedId){
                    case R.id.rb_project:
                        switchStatus(true);
                        break;
                    case R.id.rb_data:
                        switchStatus(false);
                        break;
                }
            }
        });
    }

    private void switchStatus(boolean status){
        binding.label3.setVisibility(status? View.VISIBLE:View.GONE);
        binding.label4.setVisibility(status?View.VISIBLE:View.GONE);
        binding.seekbar.setVisibility(status?View.VISIBLE:View.GONE);

    }

    @Override
    public ActivityHcBinding getBinding() {
        return binding;
    }
}
